import cv2
image=cv2.imread('animal.png')
Sobelx=cv2.Sobel(image,cv2.CV_64F,1,0)
Sobely=cv2.Sobel(image,cv2.CV_64F,0,1)
grad_x=cv2.convertScaleAbs(Sobelx)
grad_y=cv2.convertScaleAbs(Sobely)
Sobelxy=cv2.addWeighted(grad_x,0.5,grad_y,0.5,0)
Scharrx=cv2.Scharr(image,cv2.CV_64F,1,0)
Scharry=cv2.Scharr(image,cv2.CV_64F,0,1)
gradx=cv2.convertScaleAbs(Scharrx)
grady=cv2.convertScaleAbs(Scharrx)
Scharrxy=cv2.addWeighted(gradx,0.5,grady,0.5,0)
cv2.imshow("Input",image)
cv2.imshow("Sobel",Sobelxy)
cv2.imshow("Scharr",Scharrxy)
cv2.waitKey()
cv2.destroyAllWindows()